.class public final Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;
.super Ljava/lang/Object;
.source "UnhandledExceptionDumpWrapper.java"

# interfaces
.implements Ljava/lang/Thread$UncaughtExceptionHandler;


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;


# instance fields
.field private final mToDump:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lcom/burstly/lib/component/IAdaptorController;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 40
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Lcom/burstly/lib/component/IAdaptorController;)V
    .locals 1
    .parameter "componentToDump"

    .prologue
    .line 52
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 53
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;->mToDump:Ljava/lang/ref/WeakReference;

    .line 54
    return-void
.end method


# virtual methods
.method public equals(Ljava/lang/Object;)Z
    .locals 1
    .parameter "obj"

    .prologue
    .line 90
    instance-of v0, p1, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;

    return v0
.end method

.method public hashCode()I
    .locals 1

    .prologue
    .line 82
    const/4 v0, 0x1

    return v0
.end method

.method public uncaughtException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
    .locals 12
    .parameter "t"
    .parameter "e"

    .prologue
    const/4 v11, 0x0

    .line 58
    iget-object v7, p0, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;->mToDump:Ljava/lang/ref/WeakReference;

    invoke-virtual {v7}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Lcom/burstly/lib/component/IAdaptorController;

    .line 59
    .local v6, toDump:Lcom/burstly/lib/component/IAdaptorController;
    if-eqz v6, :cond_1

    .line 60
    sget-object v7, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v8, "ComponentDumper"

    const-string v9, "Current component state will be printed below. It DOES NOT mean that Burstly caused this uncaught exception it just dumps current component state to make it easier to find the cause of this exception if it is caused by Burstly code."

    new-array v10, v11, [Ljava/lang/Object;

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 63
    invoke-virtual {p2}, Ljava/lang/Throwable;->getStackTrace()[Ljava/lang/StackTraceElement;

    move-result-object v5

    .line 64
    .local v5, stackTrace:[Ljava/lang/StackTraceElement;
    const/4 v3, -0x1

    .line 65
    .local v3, indexSearch:I
    move-object v0, v5

    .local v0, arr$:[Ljava/lang/StackTraceElement;
    array-length v4, v0

    .local v4, len$:I
    const/4 v2, 0x0

    .local v2, i$:I
    :goto_0
    if-ge v2, v4, :cond_0

    aget-object v1, v0, v2

    .line 66
    .local v1, el:Ljava/lang/StackTraceElement;
    invoke-virtual {v1}, Ljava/lang/StackTraceElement;->toString()Ljava/lang/String;

    move-result-object v7

    const-string v8, "com.burstly.lib."

    invoke-virtual {v7, v8}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v3

    .line 67
    const/4 v7, -0x1

    if-eq v3, v7, :cond_2

    .line 68
    invoke-virtual {v6}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {p2, v7}, Lcom/burstly/lib/util/Utils;->addInStackTrace(Ljava/lang/Throwable;Ljava/lang/String;)V

    .line 69
    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "BurstlySDK="

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-static {}, Lcom/burstly/lib/BurstlySdk;->getSdkVersion()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "-"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    sget-object v8, Lcom/burstly/lib/constants/Constants;->BUILD_ID:Ljava/lang/String;

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {p2, v7}, Lcom/burstly/lib/util/Utils;->addInStackTrace(Ljava/lang/Throwable;Ljava/lang/String;)V

    .line 73
    .end local v1           #el:Ljava/lang/StackTraceElement;
    :cond_0
    sget-object v7, Lcom/burstly/lib/exception/UnhandledExceptionDumpWrapper;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v8, "ComponentDumper"

    const-string v9, "Dump finished."

    new-array v10, v11, [Ljava/lang/Object;

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 75
    .end local v0           #arr$:[Ljava/lang/StackTraceElement;
    .end local v2           #i$:I
    .end local v3           #indexSearch:I
    .end local v4           #len$:I
    .end local v5           #stackTrace:[Ljava/lang/StackTraceElement;
    :cond_1
    return-void

    .line 65
    .restart local v0       #arr$:[Ljava/lang/StackTraceElement;
    .restart local v1       #el:Ljava/lang/StackTraceElement;
    .restart local v2       #i$:I
    .restart local v3       #indexSearch:I
    .restart local v4       #len$:I
    .restart local v5       #stackTrace:[Ljava/lang/StackTraceElement;
    :cond_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_0
.end method
